<!DOCTYPE HTML>
<script src="../resources/gc.js"></script>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>

<!--

Accessibility Object Model
Explainer: https://github.com/WICG/aom/blob/gh-pages/explainer.md
Spec: https://wicg.github.io/aom/spec/

-->

<script>
if (window.internals)
    internals.runtimeFlags.accessibilityObjectModelEnabled = true;
</script>

<div id="atomic"></div>

<script>
test(function(t) {
    var parent = document.getElementById("atomic");
    var accessibleNode = new AccessibleNode();
    accessibleNode.role = "region";
    parent.accessibleNode.appendChild(accessibleNode);

    var axParent = accessibilityController.accessibleElementById("atomic");
    var axNode = axParent.childAtIndex(0);

    assert_equals(axNode.isAtomic, false);
    accessibleNode.atomic = true;
    assert_equals(axNode.isAtomic, true);
}, "AccessibleNode.atomic for a virtual AccessibleNode");
</script>

<div id="busy"></div>

<script>
test(function(t) {
    var parent = document.getElementById("busy");
    var accessibleNode = new AccessibleNode();
    accessibleNode.role = "status";
    parent.accessibleNode.appendChild(accessibleNode);

    var axParent = accessibilityController.accessibleElementById("busy");
    var axNode = axParent.childAtIndex(0);

    assert_equals(axNode.isBusy, false);
    accessibleNode.busy = true;
    assert_equals(axNode.isBusy, true);
}, "AccessibleNode.busy for a virtual AccessibleNode");
</script>

<div id="disabled"></div>

<script>
test(function(t) {
    var parent = document.getElementById("disabled");
    var node = new AccessibleNode();
    node.role = "checkbox";
    parent.accessibleNode.appendChild(node);

    var axParent = accessibilityController.accessibleElementById("disabled");
    var axNode = axParent.childAtIndex(0);

    assert_equals(axNode.restriction, "none");
    node.disabled = true;
    assert_equals(axNode.restriction, "disabled");
}, "AccessibleNode.disabled for a virtual AccessibleNode");
</script>

<!--
TODO still:

expanded
hidden
modal
multiline
multiselectable
readOnly
required
selected
-->
